<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style>
        img {
            width: 200px;
            height: 200px;
        }
        </style>
    </head>
    <body>
        <img src="pic/mor.jpeg">
        <script>
            var img = document.querySelector('img');
            var div = document.querySelector('div');

            var date = new Date();
            var h = date.getHours();

            if (h < 12) {
                img.src ='pic/mor.jpeg';
                div.innerHTML = '上午好';
            } else if (h < 18) {
                img.src = 'pic/after.jpeg';
                div.innerHTML = '下午好';
            } else {
                img.src = 'pic/night.gif';
                div.innerHTML = '晚上好';
            }
        </script>
    </body>
</html>
